package com.his.modules.business;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.his.modules.business.entity.MsCf01;
import com.his.modules.business.entity.MsCf02;
import com.his.modules.business.service.MsCf01Service;
import com.his.modules.business.service.MsCf02Service;
import org.apache.pdfbox.io.MemoryUsageSetting;
import org.apache.pdfbox.multipdf.PDFMergerUtility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.management.Query;
import java.io.*;


public class Test {
    public static void main(String[] args) {
        // 创建 PDFMergerUtility 实例
        PDFMergerUtility pdfMerger = new PDFMergerUtility();
//        MemoryUsageSetting memUsageSetting = new MemoryUsageSetting();

        // 设置合并后的PDF文件的输出路径
        pdfMerger.setDestinationFileName("merged.pdf");

        // 添加要合并的PDF文件
        try {
            pdfMerger.addSource(new File("C:\\Users\\Administrator\\Downloads\\037002300211_81343871.pdf"));
            pdfMerger.addSource(new File("C:\\Users\\Administrator\\Downloads\\滴滴电子发票.pdf"));
            OutputStream outputStream = new FileOutputStream("C:\\Users\\Administrator\\Downloads\\电子发票.pdf");
            pdfMerger.setDestinationStream(outputStream);
            pdfMerger.mergeDocuments(null);
            outputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
